<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

    <meta charset="UTF-8">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="css/iconfont.css">
    <link rel="stylesheet" href="css/global.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/styles.css">
    <script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
    <script src="js/bootstrap.min.js" charset="UTF-8"></script>
    <script src="js/swiper.min.js" charset="UTF-8"></script>
    <script src="js/global.js" charset="UTF-8"></script>
    <script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
    <title>U袋网</title>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            "url": "RequestServlet",                      // 要提交的URL路径
            "type": "post",                     // 发送请求的方式
            "data": "action=indexAction",                      // 要发送到服务器的数据
            "dataType": "json",
            "async": false,// 指定传输的数据格式
            "success": function (result) {
            }
        });

        $("#shownews").append("<div class=\"head-div clearfix posr\">\n" +
            "<div class=\"title\">【资讯】" + '${requestScope.newsshow.title}' +
            "</div>\n" +
            "<div class=\"time pull-right\">发布时间：" + '${requestScope.newsshow.date_in}' + "</div>\n" +
            "</div>\n" +
            "<div class=\"html-code\">\n" +
            "<p></p>\n" +
            "<p style=\"text-indent: 2em\">${requestScope.newsshow.content}</p>\n" +
            "<p><br></p>\n" +
            "</div>"
        )
        ;
    });


</script>
<!-- 顶部tab -->
<div class="tab-header">
    <div class="inner">
        <div class="pull-left">
            <div class="pull-left">嗨，欢迎来到<span class="cr">U袋网</span></div>
            <a href="temp_article/udai_article4.jsp">帮助中心</a>
        </div>
        <div class="pull-right">
            <a href="login.jsp"><span class="cr">登录</span></a>
            <a href="login.jsp?p=register">注册</a>
            <a href="udai_welcome.jsp">我的U袋</a>
            <a href="udai_order.jsp">我的订单</a>
        </div>
    </div>
</div>
<!-- 搜索栏 -->
<div class="top-search">
    <div class="inner">
        <a class="logo" href="index.jsp"><img src="images/icons/logo.jpg" alt="U袋网" class="cover"></a>
        <div class="search-box">
            <form class="input-group">
                <input placeholder="Ta们都在搜U袋网" type="text">
                <span class="input-group-btn">
						<button type="button">
							<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
						</button>
					</span>
            </form>
            <p class="help-block text-nowrap">
                <a href="">连衣裙</a>
                <a href="">裤</a>
                <a href="">衬衫</a>
                <a href="">T恤</a>
                <a href="">女包</a>
                <a href="">家居服</a>
                <a href="">2017新款</a>
            </p>
        </div>
        <div class="cart-box">
            <a href="udai_shopcart.jsp" class="cart-but">
                <i class="iconfont icon-shopcart cr fz16"></i> 购物车 0 件
            </a>
        </div>
    </div>
</div>
<!-- 内页导航栏 -->
<div class="top-nav bg3">
    <div class="nav-box inner">
        <div class="all-cat">
            <div class="title"><i class="iconfont icon-menu"></i> 全部分类</div>
        </div>
        <ul class="nva-list">
            <a href="index.jsp">
                <li class="active">首页</li>
            </a>
            <a href="temp_article/udai_article10.jsp">
                <li>企业简介</li>
            </a>
            <a href="temp_article/udai_article5.jsp">
                <li>新手上路</li>
            </a>
            <a href="class_room.jsp">
                <li>U袋学堂</li>
            </a>
            <a href="enterprise_id.jsp">
                <li>热销商品</li>
            </a>
            <a href="udai_contract.jsp">
                <li>诚信合约</li>
            </a>
            <a href="item_remove.jsp">
                <li>实时下架</li>
            </a>
        </ul>
    </div>
</div>
<div class="content inner">
    <section class="panel__div panel-message__div clearfix">
        <div class="filter-value">
            <div class="filter-title">平台公告</div>
        </div>
        <div class="pull-left">

            <div class="msg-list">
                <c:forEach var="news" items="${pb.beanList}">
                    <a class="ep" href="">【公告】${news.title}</a>
                </c:forEach>
            </div>
            <div>
                <a href="${pb.url}&pc=1">首页</a>
                <c:if test="${pb.pc > 1 }">
                    <a href="${pb.url }&pc=${pb.pc-1}">上一页</a>
                </c:if>

                <%-- 计算begin、end --%>
                <c:choose>
                    <%-- 如果总页数不足10页，那么把所有的页数都显示出来！ --%>
                    <c:when test="${pb.tp <= 7 }">
                        <c:set var="begin" value="1"/>
                        <c:set var="end" value="${pb.tp }"/>
                    </c:when>
                    <c:otherwise>
                        <%-- 当总页数>10时，通过公式计算出begin和end --%>
                        <c:set var="begin" value="${pb.pc-4 }"/>
                        <c:set var="end" value="${pb.pc + 4 }"/>
                        <%-- 头溢出 --%>
                        <c:if test="${begin < 1 }">
                            <c:set var="begin" value="1"/>
                            <c:set var="end" value="8"/>
                        </c:if>
                        <%-- 尾溢出 --%>
                        <c:if test="${end > pb.tp }">
                            <c:set var="begin" value="${pb.tp - 8 }"/>
                            <c:set var="end" value="${pb.tp }"/>
                        </c:if>
                    </c:otherwise>
                </c:choose>
                <%-- 循环遍历页码列表 --%>
                <c:forEach var="i" begin="${begin}" end="${end }">
                    <c:choose>
                        <c:when test="${i eq pb.pc }">
                            <!--当前页不要超链接 -->
                            [${i}]
                        </c:when>
                        <c:otherwise>
                            <a href="${pb.url }&pc=${i}">[${i }]</a>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>


                <!-- 首页共页上一页下页尾页 -->

                <c:if test="${pb.pc < pb.tp }">
                    <a href="${pb.url }&pc=${pb.pc+1}">下一页</a>
                </c:if>
                <a href="${pb.url }&pc=${pb.tp}">尾页</a>
                <h5>当前页: ${pb.pc} 总页数: ${pb.tp}</h5>
            </div>
        </div>
        <div class="message-box pull-right" id="shownews">
        </div>
    </section>
</div>
<!-- 右侧菜单 -->
<div class="right-nav">
    <ul class="r-with-gotop">
        <li class="r-toolbar-item">
            <a href="udai_welcome.jsp" class="r-item-hd">
                <i class="iconfont icon-user" data-badge="0"></i>
                <div class="r-tip__box"><span class="r-tip-text">用户中心</span></div>
            </a>
        </li>
        <li class="r-toolbar-item">
            <a href="udai_shopcart.jsp" class="r-item-hd">
                <i class="iconfont icon-cart"></i>
                <div class="r-tip__box"><span class="r-tip-text">购物车</span></div>
            </a>
        </li>
        <li class="r-toolbar-item">
            <a href="udai_collection.jsp" class="r-item-hd">
                <i class="iconfont icon-aixin"></i>
                <div class="r-tip__box"><span class="r-tip-text">我的收藏</span></div>
            </a>
        </li>
        <li class="r-toolbar-item">
            <a href="" class="r-item-hd">
                <i class="iconfont icon-liaotian"></i>
                <div class="r-tip__box"><span class="r-tip-text">联系客服</span></div>
            </a>
        </li>
        <li class="r-toolbar-item">
            <a href="issues.jsp" class="r-item-hd">
                <i class="iconfont icon-liuyan"></i>
                <div class="r-tip__box"><span class="r-tip-text">留言反馈</span></div>
            </a>
        </li>
        <li class="r-toolbar-item to-top">
            <i class="iconfont icon-top"></i>
            <div class="r-tip__box"><span class="r-tip-text">返回顶部</span></div>
        </li>
    </ul>
    <script>
        $(document).ready(function () {
            $('.to-top').toTop({position: false})
        });
    </script>
</div>
<!-- 底部信息 -->
<jsp:include page="dibu.jsp"></jsp:include>
</body>
</html>
